package cn.wit.summit.chwan.interfaces;

import android.support.v7.widget.RecyclerView;

import com.facebook.drawee.backends.pipeline.Fresco;

/**
 * Created by Alan on 2018/4/19.
 */

public class MyScrollListener extends RecyclerView.OnScrollListener {

    public MyScrollListener() {}

    @Override
    public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
        super.onScrollStateChanged(recyclerView, newState);
        /*
                new State
                0（SCROLL_STATE_IDLE）表示recyclerview是不动的（The RecyclerView is not currently scrolling.）
                1（SCROLL_STATE_DRAGGING）表示recyclerview正在被拖拽（The RecyclerView is currently being dragged by outside input such as user touch input.）
                2（SCROLL_STATE_SETTLING）表示recyclerview正在惯性下滚动（The RecyclerView is currently animating to a final position while not under outside control.）
                 */
        if (newState==0) {
            Fresco.getImagePipeline().resume();
        } else {
            Fresco.getImagePipeline().pause();
        }
    }
}
